#!/usr/bin/perl
#
# cleck cookie
#
use CGI;
use MIME::Base64;
use SvnUser;

my $q=CGI->new;
$q->header(-charset=>'utf-8');
$cookie=$q->cookie('svnadmin');
$auth=decode_base64($cookie);

@auth=split(/:/,$auth);
$cookie_uid=$auth[0];
$cookie_pwd=$auth[1];

$auth=SvnUser::get_pwd($cookie_uid);
if(($auth eq "")||($cookie_pwd ne $auth)){
	$cookie=$q->cookie(
		-name=>'svnadmin',
		-value=>'');
	print $q->header(-cookie=>$cookie,'Location'=>'./login.cgi');
	exit 0;
}
return 1;
